home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / usenet / sources / volume91 / devices / sanainov / part01 next >
Internet Message Format  |  1991-11-16  |  59KB

  1. Path: news.larc.nasa.gov!amiga-request
  2. From: amiga-request@ab20.larc.nasa.gov (Amiga Sources/Binaries Moderator)
  3. Subject: v91i192: SANA-II - the SANA-II Network Device Driver Specification, Part01/04
  4. Reply-To: dlarson@cbmvax.uucp (Dale Larson)
  5. Newsgroups: comp.sources.amiga
  6. Message-ID: <comp.sources.amiga.v91i192@ab20.larc.nasa.gov>
  7. Date: 16 Nov 91 11:10:29 GMT
  8. Approved: tadguy@uunet.UU.NET (Tad Guy)
  9. X-Mail-Submissions-To: amiga@uunet.uu.net
  10. X-Post-Discussions-To: comp.sys.amiga.misc
  11.  
  12. Submitted-by: dlarson@cbmvax.uucp (Dale Larson)
  13. Posting-number: Volume 91, Issue 192
  14. Archive-name: devices/sana-ii-nov7/part01
  15.  
  16. [ uuencoded binaries included  ...tad ]
  17.  
  18. The SANA-II Network Device Driver Specification is a standard for the
  19. interface to any Amiga networking hardware.  It is a specification for an
  20. Amiga software interface to the data link layer in the ISO 7-Layer Reference
  21. Model of Open Systems Interconnection.  All Amiga network hardware vendors
  22. should supply a SANA-II device driver for their hardware. All protocol writers
  23. should talk to SANA-II device drivers rather than to network hardware.  Any
  24. protocol stack should work with any SANA-II device driver.  The standard has
  25. been kept simple and straight-forward so that SANA-II device drivers should be
  26. easy to write and to use.  They should be highly efficient and have low
  27. resource usage.  Any SANA-II device driver should behave very much like any
  28. other SANA-II device driver.
  29.  
  30. Application writers must not use SANA-II Device Drivers directly.
  31. Applications must use the API provided by the network protocol software the
  32. application supports.  It is hoped that a standard network API for all Amigas
  33. will be made available by Commodore in the near future.
  34.  
  35. This version of the standard addresses issues from the original SANA-II
  36. standard which were raised in the 1991 North American and European Amiga
  37. DevCons as well as in the conversion of existing protocols to the use of the
  38. standard.  This draft reflects several rounds of comments from active
  39. implementors of SANA-II software.  Most of the changes are simplifications and
  40. should be easy to incorporate into any work in progress.  The changes should
  41. make the writing and use of SANA-II drivers much easier.  Commodore's internal
  42. versions of the A2065 and other drivers and the AS225 software package are
  43. currently compliant with this version of the SANA-II spec.
  44.  
  45. This version of the specification is very solid and will stand as final unless
  46. comments containing very compelling objections are received by December 31,
  47. 1991.  All SANA-II device drivers and software utilizing those drivers should
  48. be written to this version of the specification.
  49.  
  50. Distribution of this version of the standard is unlimited.
  51.  
  52. This distribution contains the SANA-II Network Device Driver Specification,
  53. version of November 7, 1991, for final comment and approval.  This means
  54. that no additional changes are expected and that only compelling objections
  55. will keep this version of the spec from becoming final on January 1, 1991.
  56.  
  57. This distribution also contains supporting materials in the form of some
  58. example code.  More example code, including a skeleton SANA-II device
  59. driver, are planned for the near future.
  60.  
  61. Finally, so that you can actually use this now to develop network protocols,
  62. a beta binary of our A2065 ethernet driver is included.
  63.  
  64. FILES
  65.  
  66.     README        - this file.
  67.     driver.txt    - text of driver specification.
  68.     sana2driver.doc    - autodoc for driver specification.
  69.     copybuff.doc    - autodoc for buffer management functions in spec.
  70.  
  71.     devs/a2065.device - *beta* version of Commodore ethernet driver.
  72.                 (also works with Ameristar ethernet boards)
  73.  
  74.     plus include files for the specification in "include/devices"
  75.     plus example programs in "examples"
  76.  
  77. #!/bin/sh
  78. # This is a shell archive.  Remove anything before this line, then unpack
  79. # it by saving it into a file and typing "sh file".  To overwrite existing
  80. # files, type "sh file -c".  You can also feed this as standard input via
  81. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  82. # will see the following message at the end:
  83. #        "End of archive 1 (of 4)."
  84. # Contents:  copybuff.doc devs examples examples/configure
  85. #   examples/configure/configure.c examples/configure/lmkfile
  86. #   examples/devquery examples/devquery/devquery.c
  87. #   examples/devquery/lmkfile examples/globstats
  88. #   examples/globstats/globstats.c examples/globstats/lmkfile
  89. #   examples/offline examples/offline/lmkfile
  90. #   examples/offline/offline.c examples/online examples/online/lmkfile
  91. #   examples/online/online.c examples/readme examples/skeleton
  92. #   examples/skeleton/skeleton.c examples/skeleton/skeleton.h
  93. #   examples/typestats examples/typestats/lmkfile
  94. #   examples/typestats/typestats.c examples/waitforonline
  95. #   examples/waitforonline/lmkfile
  96. #   examples/waitforonline/waitforonline.c include include/devices
  97. #   include/devices/sana2.h include/devices/sana2.i
  98. #   include/devices/sana2specialstats.h
  99. #   include/devices/sana2specialstats.i readme
  100. # Wrapped by tadguy@ab20 on Fri Nov 15 14:11:14 1991
  101. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  102. if test -f 'copybuff.doc' -a "${1}" != "-c" ; then 
  103.   echo shar: Will not clobber existing file \"'copybuff.doc'\"
  104. else
  105. echo shar: Extracting \"'copybuff.doc'\" \(2995 characters\)
  106. sed "s/^X//" >'copybuff.doc' <<'END_OF_FILE'
  107. XTABLE OF CONTENTS
  108. X
  109. Xany_sana2_protocol/CopyFromBuff
  110. Xany_sana2_protocol/CopyToBuff
  111. X any_sana2_protocol/CopyFromBuff               any_sana2_protocol/CopyFromBuff
  112. X
  113. X   NAME
  114. X    CopyFromBuff -- Copy n bytes from an abstract data structure.
  115. X
  116. X   SYNOPSIS
  117. X    success = CopyFromBuff(to, from, n)
  118. X    d0               a0  a1    d0
  119. X
  120. X    BOOL CopyToBuff(VOID *, VOID *, LONG);
  121. X
  122. X   FUNCTION
  123. X    This function copies 'n' bytes of data in the abstract data structure
  124. X    pointed to by 'from' into the contigous memory pointed to by 'to'.
  125. X    'to' must contain at least 'n' bytes of usable memory or innocent
  126. X    memory will be overwritten.
  127. X
  128. X   INPUTS
  129. X    to        - pointer to contiguous memory to copy to.
  130. X    n        - number of bytes to copy.
  131. X    from        - pointer to abstract structure to copy to.
  132. X
  133. X   RESULT
  134. X    success        - TRUE if operation was successful, else FALSE.
  135. X
  136. X   EXAMPLE
  137. X
  138. X   NOTES
  139. X    This function must be callable from interupts.  In particular, this
  140. X    means that this function may not directly or indirectly call any
  141. X    system memory functions (since those functions rely on Forbid() to
  142. X    protect themselves) and that  you must not compile this function
  143. X    with stack checking enabled.  See the RKM:Libraries Exec:Interupts
  144. X    chapter for more details on what is legal in a routine called from
  145. X    an interupt handler.
  146. X
  147. X    'C' programmers should not compile with stack checking (option '-v'
  148. X    in SAS) and should geta4() or __saveds.
  149. X
  150. X   BUGS
  151. X
  152. X   SEE ALSO
  153. X
  154. X any_sana2_protocol/CopyToBuff                   any_sana2_protocol/CopyToBuff
  155. X
  156. X   NAME
  157. X    CopyToBuff -- Copy n bytes to an abstract data structure.
  158. X
  159. X   SYNOPSIS
  160. X    success = CopyToBuff(to, from, n)
  161. X    d0             a0  a1    d0
  162. X
  163. X    BOOL CopyToBuff(VOID *, VOID *, LONG);
  164. X
  165. X   FUNCTION
  166. X    This function first does any initialization and/or allocation
  167. X    required to prepare the abstract data structure pointed at by 'to'
  168. X    to be filled with 'n' bytes of data from 'from'.  It then executes
  169. X    the copy operation.
  170. X
  171. X    If, for example, there is not enough memory available to prepare
  172. X    the abstract data structure, the call is failed and FALSE is returned.
  173. X
  174. X    The buffer management scheme should be such that any memory needed
  175. X    to fulfill CopyToBuff() calls is already allocated from the system
  176. X    before the call to CopyToBuff() is made.
  177. X
  178. X   INPUTS
  179. X    from        - pointer to contiguous memory to copy from.
  180. X    n        - number of bytes to copy.
  181. X    to        - pointer to abstract structure to copy to.
  182. X
  183. X   RESULT
  184. X    success        - TRUE if operation was successful, else FALSE.
  185. X
  186. X   EXAMPLE
  187. X
  188. X   NOTES
  189. X    This function must be callable from interupts.  In particular, this
  190. X    means that this function may not directly or indirectly call any
  191. X    system memory functions (since those functions rely on Forbid() to
  192. X    protect themselves) and that you must not compile this function
  193. X    with stack checking enabled.  See the RKM:Libraries Exec:Interupts
  194. X    chapter for more details on what is legal in a routine called from
  195. X    an interupt handler.
  196. X
  197. X    'C' programmers should not compile with stack checking (option '-v'
  198. X    in SAS) and should geta4() or __saveds.
  199. X
  200. X   BUGS
  201. X
  202. X   SEE ALSO
  203. X
  204. X
  205. END_OF_FILE
  206. if test 2995 -ne `wc -c <'copybuff.doc'`; then
  207.     echo shar: \"'copybuff.doc'\" unpacked with wrong size!
  208. fi
  209. # end of 'copybuff.doc'
  210. fi
  211. if test ! -d 'devs' ; then
  212.     echo shar: Creating directory \"'devs'\"
  213.     mkdir 'devs'
  214. fi
  215. if test ! -d 'examples' ; then
  216.     echo shar: Creating directory \"'examples'\"
  217.     mkdir 'examples'
  218. fi
  219. if test ! -d 'examples/configure' ; then
  220.     echo shar: Creating directory \"'examples/configure'\"
  221.     mkdir 'examples/configure'
  222. fi
  223. if test -f 'examples/configure/configure.c' -a "${1}" != "-c" ; then 
  224.   echo shar: Will not clobber existing file \"'examples/configure/configure.c'\"
  225. else
  226. echo shar: Extracting \"'examples/configure/configure.c'\" \(3800 characters\)
  227. sed "s/^X//" >'examples/configure/configure.c' <<'END_OF_FILE'
  228. X/*
  229. X**  $Id: configure.c,v 1.2 91/11/12 16:23:41 dlarson Exp Locker: dlarson $
  230. X**
  231. X**  SANA-II driver configuration example.
  232. X**
  233. X**  Copyright 1991 Commodore-Amiga, Inc.
  234. X**
  235. X**  This code may be modified and used freely on Amiga computers.
  236. X**
  237. X**
  238. X**  This example is pretty ugly and should be cleaned up.  Sorry.
  239. X**  Still, you should be able to see the proper steps to take
  240. X**  in configuring a SANA-II device.
  241. X*/
  242. X
  243. X#define NOBUFFS
  244. X#include "/skeleton/skeleton.h"
  245. X
  246. Xstruct MsgPort   *DevPort = NULL;
  247. Xstruct IOSana2Req *IOB1    = NULL;
  248. X
  249. Xint    DeviceOpen = 0;
  250. Xlong    DevBits;
  251. Xint    NumBytes;
  252. X
  253. Xvoid DoConfig(UBYTE *Address);
  254. Xvoid DoGetAddr(void);
  255. Xvoid DoQuery(struct Sana2DeviceQuery *q);
  256. Xvoid DoPrintAddr(void);
  257. X
  258. X
  259. Xmain(int argc, char *argv[])
  260. X{
  261. Xint i;
  262. Xlong temp;
  263. Xstruct Sana2DeviceQuery Query;
  264. X
  265. X        if(!initdev())
  266. X        {
  267. X            printf("Open Failed.\n");
  268. X            goto bottom;
  269. X        }
  270. X        printf("About to Query the device.\n");
  271. X    Query.SizeAvailable = sizeof(Query);
  272. X    DoQuery(&Query);
  273. X    if(IOB1->ios2_Req.io_Error)
  274. X    {
  275. X                printf("ERROR RETURNED: %ld\n", (long)IOB1->ios2_Req.io_Error);
  276. X        goto bottom;
  277. X         }
  278. X        if(Query.AddrFieldSize%8 != 0 || Query.AddrFieldSize == 0)
  279. X    {
  280. X        printf("Oh, no!  There really is funny hardware in the world!\n"
  281. X               "Address field is %d bits.  This example needs to be\n"
  282. X               "updated to understand address fields with a number of\n"
  283. X               "bits not divisible by eight.\n", Query.AddrFieldSize);
  284. X        goto bottom;
  285. X    }
  286. X    NumBytes = Query.AddrFieldSize/8;
  287. X    if(argc>1)
  288. X    {
  289. X        for(i=0; i<NumBytes; i++)
  290. X        {
  291. X            sscanf(argv[1]+(i*3), "%lx", &temp);
  292. X            IOB1->ios2_SrcAddr[i] = (char)temp;
  293. X        }
  294. X    }else
  295. X    {
  296. X        printf("\nNo user address, getting ROM address.\n");
  297. X        DoGetAddr();
  298. X        if (IOB1->ios2_Req.io_Error)
  299. X        {
  300. X            printf("ERROR RETURNED: 0x%lx\n",
  301. X                           (long)IOB1->ios2_Req.io_Error);
  302. X            goto bottom;
  303. X             }
  304. X         }
  305. X         printf("SrcAddr is one we're going to attempt to configure with:\n");
  306. X    DoPrintAddr();
  307. X    printf("Attempting to set address\n");
  308. X    DoConfig(IOB1->ios2_SrcAddr);
  309. X    if(IOB1->ios2_Req.io_Error)
  310. X    {
  311. X        if(IOB1->ios2_Req.io_Error == S2ERR_BAD_STATE &&
  312. X           IOB1->ios2_WireError == S2WERR_IS_CONFIGURED)
  313. X            printf("Pardon Me. I'm Already Configured!\n");
  314. X        else
  315. X            printf("ERROR CODE:%ld  WERR:%ld\n",
  316. X                (long)IOB1->ios2_Req.io_Error,
  317. X                (long)IOB1->ios2_WireError);
  318. X    } else
  319. X    {
  320. X        printf("Configured.  Results (SrcAddr is the address actually config'd to):\n");
  321. X        DoPrintAddr();
  322. X        printf("S2_GETSTATIONADDRESS and results (Src=Current  Dst=Default):\n");
  323. X        DoGetAddr();  /* really should check for an error, device could be offline, for example  */
  324. X        DoPrintAddr();
  325. X    }
  326. Xbottom: closedev();
  327. X}
  328. X
  329. X
  330. Xvoid DoConfig(UBYTE *Address)
  331. X{
  332. Xregister UBYTE *p = IOB1->ios2_SrcAddr;
  333. Xregister i;
  334. X
  335. X        IOB1->ios2_Req.io_Error   = 0;
  336. X        IOB1->ios2_Req.io_Flags   = IOF_QUICK;
  337. X        IOB1->ios2_Req.io_Command = S2_CONFIGINTERFACE;
  338. X        for(i = 0; i <  NumBytes; i++)
  339. X            *(p++) = *(Address++);
  340. X        DoIO((struct IORequest *)IOB1);
  341. X}
  342. X
  343. X
  344. Xvoid DoQuery(struct Sana2DeviceQuery *q)
  345. X{
  346. X
  347. X        IOB1->ios2_Req.io_Error   = 0;
  348. X        IOB1->ios2_Req.io_Flags   = IOF_QUICK;
  349. X        IOB1->ios2_Req.io_Command = S2_DEVICEQUERY;
  350. X        IOB1->ios2_StatData = q;
  351. X        DoIO((struct IORequest *)IOB1);
  352. X        IOB1->ios2_StatData = NULL;
  353. X}
  354. X
  355. X
  356. Xvoid DoGetAddr(void)
  357. X{
  358. X
  359. X        IOB1->ios2_Req.io_Error   = 0;
  360. X        IOB1->ios2_Req.io_Flags   = IOF_QUICK;
  361. X        IOB1->ios2_Req.io_Command = S2_GETSTATIONADDRESS;
  362. X        DoIO((struct IORequest *)IOB1);
  363. X}
  364. X
  365. Xvoid DoPrintAddr(void)
  366. X{
  367. Xregister i;
  368. X
  369. X    printf("SrcAddr: ");
  370. X        for (i = 0; i <  NumBytes; i++)
  371. X        printf("%02x ", (long)(IOB1->ios2_SrcAddr[i] & 0xFF)) ;
  372. X    printf("\nDstAddr: ");
  373. X        for (i = 0; i <  NumBytes; i++)
  374. X        printf("%02x ", (long)(IOB1->ios2_DstAddr[i] & 0xFF)) ;
  375. X    printf("\n");
  376. X}
  377. X
  378. END_OF_FILE
  379. if test 3800 -ne `wc -c <'examples/configure/configure.c'`; then
  380.     echo shar: \"'examples/configure/configure.c'\" unpacked with wrong size!
  381. fi
  382. # end of 'examples/configure/configure.c'
  383. fi
  384. if test -f 'examples/configure/lmkfile' -a "${1}" != "-c" ; then 
  385.   echo shar: Will not clobber existing file \"'examples/configure/lmkfile'\"
  386. else
  387. echo shar: Extracting \"'examples/configure/lmkfile'\" \(258 characters\)
  388. sed "s/^X//" >'examples/configure/lmkfile' <<'END_OF_FILE'
  389. XINCFLAGS = -isana2:include
  390. XCLIB   = lib:lc.lib lib:amiga.lib lib:debug.lib
  391. X
  392. Xall: configure
  393. X
  394. Xconfigure: configure.o /skeleton/skeleton.o
  395. X    blink FROM lib:c.o $@.o /skeleton/skeleton.o TO $@ LIB $(CLIB)
  396. X
  397. X#NO STACK CHECKING!!!
  398. X.c.o:
  399. X    lc $(INCFLAGS) -v -csuq $*
  400. X
  401. END_OF_FILE
  402. if test 258 -ne `wc -c <'examples/configure/lmkfile'`; then
  403.     echo shar: \"'examples/configure/lmkfile'\" unpacked with wrong size!
  404. fi
  405. # end of 'examples/configure/lmkfile'
  406. fi
  407. if test ! -d 'examples/devquery' ; then
  408.     echo shar: Creating directory \"'examples/devquery'\"
  409.     mkdir 'examples/devquery'
  410. fi
  411. if test -f 'examples/devquery/devquery.c' -a "${1}" != "-c" ; then 
  412.   echo shar: Will not clobber existing file \"'examples/devquery/devquery.c'\"
  413. else
  414. echo shar: Extracting \"'examples/devquery/devquery.c'\" \(1546 characters\)
  415. sed "s/^X//" >'examples/devquery/devquery.c' <<'END_OF_FILE'
  416. X/*
  417. X**  $Id: devquery.c,v 1.1 91/11/13 11:07:16 dlarson Exp $
  418. X**
  419. X**  SANA-II driver device query example.
  420. X**
  421. X**  Copyright 1991 Commodore-Amiga, Inc.
  422. X**
  423. X**  This code may be modified and used freely on Amiga computers.
  424. X**
  425. X*/
  426. X
  427. X#define NOBUFFS
  428. X#include "/skeleton/skeleton.h"
  429. X
  430. Xstruct MsgPort   *DevPort = NULL;
  431. Xstruct IOSana2Req *IOB1   = NULL;
  432. X
  433. Xint    DeviceOpen = 0;
  434. Xlong   DevBits;
  435. X
  436. X
  437. Xmain(int argc, char *argv[])
  438. X{
  439. Xstruct Sana2DeviceQuery query;
  440. X
  441. X    if(!initdev())
  442. X    {
  443. X        printf("Open Failed\n");
  444. X        goto bottom;
  445. X    }
  446. X        printf("About to Query the device.\n");
  447. X    query.SizeAvailable = sizeof(query);
  448. X        IOB1->ios2_Req.io_Error   = 0;
  449. X        IOB1->ios2_Req.io_Flags   = IOF_QUICK;
  450. X        IOB1->ios2_Req.io_Command = S2_DEVICEQUERY;
  451. X        IOB1->ios2_StatData = &query;
  452. X        DoIO((struct IORequest *)IOB1);
  453. X        IOB1->ios2_StatData = NULL;
  454. X    if(IOB1->ios2_Req.io_Error)
  455. X    {
  456. X                printf("ERROR RETURNED:%ld  WERR:%ld\n",
  457. X                       (long)IOB1->ios2_Req.io_Error,
  458. X                       (long)IOB1->ios2_WireError);
  459. X        goto bottom;
  460. X         }
  461. X    printf("Query results:\n");
  462. X    printf("Size available:%ld  Size Supplied:%ld  DevQueryFormat:%ld\n",
  463. X           query.SizeAvailable, query.SizeSupplied, query.DevQueryFormat);
  464. X    printf("DeviceLevel:%ld\n", query.DeviceLevel);
  465. X    printf("Number of bits in address:%ld\n", (long)query.AddrFieldSize);
  466. X    printf("Maximum Transmition Unit: %ld\n", query.MTU);
  467. X    printf("Bits Per Second:          %ld\n", query.BPS);
  468. X    printf("HardwareType:             %ld\n", query.HardwareType);
  469. Xbottom:    closedev();
  470. X}
  471. END_OF_FILE
  472. if test 1546 -ne `wc -c <'examples/devquery/devquery.c'`; then
  473.     echo shar: \"'examples/devquery/devquery.c'\" unpacked with wrong size!
  474. fi
  475. # end of 'examples/devquery/devquery.c'
  476. fi
  477. if test -f 'examples/devquery/lmkfile' -a "${1}" != "-c" ; then 
  478.   echo shar: Will not clobber existing file \"'examples/devquery/lmkfile'\"
  479. else
  480. echo shar: Extracting \"'examples/devquery/lmkfile'\" \(255 characters\)
  481. sed "s/^X//" >'examples/devquery/lmkfile' <<'END_OF_FILE'
  482. XINCFLAGS = -isana2:include
  483. XCLIB   = lib:lc.lib lib:amiga.lib lib:debug.lib
  484. X
  485. Xall: devquery
  486. X
  487. Xdevquery: devquery.o /skeleton/skeleton.o
  488. X    blink FROM lib:c.o $@.o /skeleton/skeleton.o TO $@ LIB $(CLIB)
  489. X
  490. X#NO STACK CHECKING!!!
  491. X.c.o:
  492. X    lc $(INCFLAGS) -v -csuq $*
  493. X
  494. END_OF_FILE
  495. if test 255 -ne `wc -c <'examples/devquery/lmkfile'`; then
  496.     echo shar: \"'examples/devquery/lmkfile'\" unpacked with wrong size!
  497. fi
  498. # end of 'examples/devquery/lmkfile'
  499. fi
  500. if test ! -d 'examples/globstats' ; then
  501.     echo shar: Creating directory \"'examples/globstats'\"
  502.     mkdir 'examples/globstats'
  503. fi
  504. if test -f 'examples/globstats/globstats.c' -a "${1}" != "-c" ; then 
  505.   echo shar: Will not clobber existing file \"'examples/globstats/globstats.c'\"
  506. else
  507. echo shar: Extracting \"'examples/globstats/globstats.c'\" \(1370 characters\)
  508. sed "s/^X//" >'examples/globstats/globstats.c' <<'END_OF_FILE'
  509. X/*
  510. X**  $Id: globstats.c,v 1.4 91/11/13 11:18:52 dlarson Exp $
  511. X**
  512. X**  SANA-II driver utility -- Print statistics for device.
  513. X**
  514. X**  Copyright 1991 Commodore-Amiga, Inc.
  515. X**
  516. X**  This code may be modified and used freely on Amiga computers.
  517. X**
  518. X*/
  519. X
  520. X
  521. X#define NOBUFFS 1
  522. X#include "/skeleton/skeleton.h"
  523. X
  524. Xstruct MsgPort   *DevPort = NULL;
  525. Xstruct IOSana2Req *IOB1    = NULL;
  526. Xstruct Sana2DeviceStats Stats;
  527. X
  528. Xint    DeviceOpen = 0;
  529. Xlong   DevBits;
  530. X
  531. Xvoid PrintStats(void);
  532. Xvoid GetGlobalStats(void);
  533. X
  534. X
  535. Xmain(argc , argv)
  536. Xchar *argv[];
  537. X{
  538. X    if(!initdev())
  539. X        printf("Open Failed.\n");
  540. X    else
  541. X    {
  542. X        GetGlobalStats();
  543. X        if (!IOB1->ios2_Req.io_Error)
  544. X            PrintStats();
  545. X        else
  546. X            printf("Error Returned: %ld WireError: %ld\n" , IOB1->ios2_Req.io_Error , IOB1->ios2_WireError);
  547. X    }
  548. Xbottom:    closedev();
  549. X    return(0);
  550. X}
  551. X
  552. Xvoid GetGlobalStats(void)
  553. X{
  554. X    IOB1->ios2_Req.io_Error   = 0;
  555. X    IOB1->ios2_Req.io_Flags   = IOF_QUICK;
  556. X    IOB1->ios2_Req.io_Command = S2_GETGLOBALSTATS;
  557. X    IOB1->ios2_StatData = &Stats;
  558. X    DoIO(IOB1);
  559. X}
  560. X
  561. Xvoid PrintStats(void)
  562. X{
  563. X    printf("Packets Received:    %d\n" , Stats.PacketsReceived);
  564. X    printf("Packets Transmitted: %d\n" , Stats.PacketsSent);
  565. X    printf("CRC Errors:          %d\n" , Stats.BadData);
  566. X    printf("Unknown Packets:     %d\n" , Stats.UnknownTypesReceived);
  567. X    printf("Fifo Overruns:       %d\n" , Stats.Overruns);
  568. X    printf("Reconfigurations:    %d\n" , Stats.Reconfigurations);
  569. X}
  570. END_OF_FILE
  571. if test 1370 -ne `wc -c <'examples/globstats/globstats.c'`; then
  572.     echo shar: \"'examples/globstats/globstats.c'\" unpacked with wrong size!
  573. fi
  574. # end of 'examples/globstats/globstats.c'
  575. fi
  576. if test -f 'examples/globstats/lmkfile' -a "${1}" != "-c" ; then 
  577.   echo shar: Will not clobber existing file \"'examples/globstats/lmkfile'\"
  578. else
  579. echo shar: Extracting \"'examples/globstats/lmkfile'\" \(258 characters\)
  580. sed "s/^X//" >'examples/globstats/lmkfile' <<'END_OF_FILE'
  581. XINCFLAGS = -isana2:include
  582. XCLIB   = lib:lc.lib lib:amiga.lib lib:debug.lib
  583. X
  584. Xall: globstats
  585. X
  586. Xglobstats: globstats.o /skeleton/skeleton.o
  587. X    blink FROM lib:c.o $@.o /skeleton/skeleton.o TO $@ LIB $(CLIB)
  588. X
  589. X#NO STACK CHECKING!!!
  590. X.c.o:
  591. X    lc $(INCFLAGS) -v -csuq $*
  592. X
  593. END_OF_FILE
  594. if test 258 -ne `wc -c <'examples/globstats/lmkfile'`; then
  595.     echo shar: \"'examples/globstats/lmkfile'\" unpacked with wrong size!
  596. fi
  597. # end of 'examples/globstats/lmkfile'
  598. fi
  599. if test ! -d 'examples/offline' ; then
  600.     echo shar: Creating directory \"'examples/offline'\"
  601.     mkdir 'examples/offline'
  602. fi
  603. if test -f 'examples/offline/lmkfile' -a "${1}" != "-c" ; then 
  604.   echo shar: Will not clobber existing file \"'examples/offline/lmkfile'\"
  605. else
  606. echo shar: Extracting \"'examples/offline/lmkfile'\" \(253 characters\)
  607. sed "s/^X//" >'examples/offline/lmkfile' <<'END_OF_FILE'
  608. XINCFLAGS = -isana2:include
  609. XCLIB   = lib:lc.lib lib:amiga.lib lib:debug.lib
  610. X
  611. Xall: offline
  612. X
  613. Xoffline: offline.o /skeleton/skeleton.o
  614. X    blink FROM lib:c.o $@.o /skeleton/skeleton.o TO $@ LIB $(CLIB)
  615. X
  616. X
  617. X#NO STACK CHECKING!!!
  618. X.c.o:
  619. X    lc $(INCFLAGS) -v -csuq $*
  620. X
  621. END_OF_FILE
  622. if test 253 -ne `wc -c <'examples/offline/lmkfile'`; then
  623.     echo shar: \"'examples/offline/lmkfile'\" unpacked with wrong size!
  624. fi
  625. # end of 'examples/offline/lmkfile'
  626. fi
  627. if test -f 'examples/offline/offline.c' -a "${1}" != "-c" ; then 
  628.   echo shar: Will not clobber existing file \"'examples/offline/offline.c'\"
  629. else
  630. echo shar: Extracting \"'examples/offline/offline.c'\" \(919 characters\)
  631. sed "s/^X//" >'examples/offline/offline.c' <<'END_OF_FILE'
  632. X/*
  633. X**  $Id: offline.c,v 1.4 91/11/13 11:12:08 dlarson Exp $
  634. X**
  635. X**  SANA-II driver utility -- Make online driver go offline.
  636. X**
  637. X**  Copyright 1991 Commodore-Amiga, Inc.
  638. X**
  639. X**  This code may be modified and used freely on Amiga computers.
  640. X**
  641. X*/
  642. X
  643. X
  644. X#define NOBUFFS
  645. X#include "/skeleton/skeleton.h"
  646. X
  647. Xstruct MsgPort   *DevPort = NULL;
  648. Xstruct IOSana2Req *IOB1    = NULL;
  649. X
  650. Xint    DeviceOpen = 0;
  651. Xlong   DevBits;
  652. X
  653. Xvoid DoOffLine();
  654. X
  655. X
  656. Xmain(argc , argv)
  657. Xchar *argv[];
  658. X{
  659. X    if (!initdev())
  660. X        printf("Open Failed\n");
  661. X    else
  662. X    {
  663. X        printf("Attempting To Go OffLine\n");
  664. X        DoOffLine();
  665. X        if (IOB1->ios2_Req.io_Error)
  666. X            printf("Error: %ld WireError: %ld\n",
  667. X                   (long)IOB1->ios2_Req.io_Error,
  668. X                   IOB1->ios2_WireError);
  669. X        else
  670. X            printf("No Error\n");
  671. X
  672. X    }
  673. Xbottom:    closedev();
  674. X}
  675. X
  676. X
  677. Xvoid DoOffLine()
  678. X{
  679. X    IOB1->ios2_Req.io_Error   = 0;
  680. X    IOB1->ios2_Req.io_Flags   = IOF_QUICK;
  681. X    IOB1->ios2_Req.io_Command = S2_OFFLINE;
  682. X    DoIO(IOB1);
  683. X}
  684. END_OF_FILE
  685. if test 919 -ne `wc -c <'examples/offline/offline.c'`; then
  686.     echo shar: \"'examples/offline/offline.c'\" unpacked with wrong size!
  687. fi
  688. # end of 'examples/offline/offline.c'
  689. fi
  690. if test ! -d 'examples/online' ; then
  691.     echo shar: Creating directory \"'examples/online'\"
  692.     mkdir 'examples/online'
  693. fi
  694. if test -f 'examples/online/lmkfile' -a "${1}" != "-c" ; then 
  695.   echo shar: Will not clobber existing file \"'examples/online/lmkfile'\"
  696. else
  697. echo shar: Extracting \"'examples/online/lmkfile'\" \(250 characters\)
  698. sed "s/^X//" >'examples/online/lmkfile' <<'END_OF_FILE'
  699. XINCFLAGS = -isana2:include
  700. XCLIB   = lib:lc.lib lib:amiga.lib lib:debug.lib
  701. X
  702. Xall: online
  703. X
  704. Xonline: online.o /skeleton/skeleton.o
  705. X    blink FROM lib:c.o $@.o /skeleton/skeleton.o TO $@ LIB $(CLIB)
  706. X
  707. X
  708. X#NO STACK CHECKING!!!
  709. X.c.o:
  710. X    lc $(INCFLAGS) -v -csuq $*
  711. X
  712. END_OF_FILE
  713. if test 250 -ne `wc -c <'examples/online/lmkfile'`; then
  714.     echo shar: \"'examples/online/lmkfile'\" unpacked with wrong size!
  715. fi
  716. # end of 'examples/online/lmkfile'
  717. fi
  718. if test -f 'examples/online/online.c' -a "${1}" != "-c" ; then 
  719.   echo shar: Will not clobber existing file \"'examples/online/online.c'\"
  720. else
  721. echo shar: Extracting \"'examples/online/online.c'\" \(899 characters\)
  722. sed "s/^X//" >'examples/online/online.c' <<'END_OF_FILE'
  723. X/*
  724. X**  $Id: online.c,v 1.4 91/11/13 11:10:51 dlarson Exp $
  725. X**
  726. X**  SANA-II driver utility -- Make offline driver come online.
  727. X**
  728. X**  Copyright 1991 Commodore-Amiga, Inc.
  729. X**
  730. X**  This code may be modified and used freely on Amiga computers.
  731. X**
  732. X*/
  733. X
  734. X#define NOBUFFS
  735. X#include "/skeleton/skeleton.h"
  736. X
  737. Xstruct MsgPort   *DevPort = NULL;
  738. Xstruct IOSana2Req *IOB1    = NULL;
  739. X
  740. Xint    DeviceOpen = 0;
  741. Xlong   DevBits;
  742. X
  743. Xvoid DoOnLine();
  744. X
  745. X
  746. Xmain(argc , argv)
  747. Xchar *argv[];
  748. X{
  749. X    if(!initdev())
  750. X        printf("Open Failed\n");
  751. X    else
  752. X    {
  753. X        printf("Attempting To Go OnLine\n");
  754. X        DoOnLine();
  755. X        if(IOB1->ios2_Req.io_Error)
  756. X            printf("Error: %ld WireError: %ld\n",
  757. X                (long)IOB1->ios2_Req.io_Error,
  758. X                IOB1->ios2_WireError);
  759. X        else
  760. X            printf("No Error\n");
  761. X
  762. X    }
  763. Xbottom:    closedev();
  764. X}
  765. X
  766. Xvoid DoOnLine()
  767. X{
  768. X    IOB1->ios2_Req.io_Error   = 0;
  769. X    IOB1->ios2_Req.io_Flags   = IOF_QUICK;
  770. X    IOB1->ios2_Req.io_Command = S2_ONLINE;
  771. X    DoIO(IOB1);
  772. X}
  773. END_OF_FILE
  774. if test 899 -ne `wc -c <'examples/online/online.c'`; then
  775.     echo shar: \"'examples/online/online.c'\" unpacked with wrong size!
  776. fi
  777. # end of 'examples/online/online.c'
  778. fi
  779. if test -f 'examples/readme' -a "${1}" != "-c" ; then 
  780.   echo shar: Will not clobber existing file \"'examples/readme'\"
  781. else
  782. echo shar: Extracting \"'examples/readme'\" \(2190 characters\)
  783. sed "s/^X//" >'examples/readme' <<'END_OF_FILE'
  784. X$Id: readme,v 1.3 91/11/13 10:09:29 dlarson Exp $
  785. X
  786. XThese are utilties for use with SANA-II drivers.  Some may be useful to
  787. Xadvanced end-users (with some additional work) but all should be useful to
  788. XSANA-II developers.  The source code to these utilities should provide good
  789. Xexamples of how to use much of the functionality within the standard, and the
  790. Xbehavior of the utilities should help to test new driver implementations.
  791. X
  792. XMost of the utilities take advantage of skeleton.c and skeleton.h which
  793. Xinclude functions for opening and closing a SANA-II device.  Notably, these
  794. Xfunctions read the device to open and the unit number to open from the
  795. Xenvironment variables SANA.Device and SANA.Unit if those enviroment variables
  796. Xexist, else the user is queried.
  797. X
  798. XNone of the utilities are optimized in any way and all could be made much
  799. Xsmaller, but they probably do not warrant any time for any optimizations, at
  800. Xleast not at this time.
  801. X
  802. XIf any of these are ever made into end-user utilities, they should be Amigaized
  803. X(readargs, no printf(), more reasonable  version
  804. Xnumbers, etc.  As it is, they are tiny and source would be included in any
  805. Xdistribution anyway.  (OK, maybe that's still not a good excuse.)
  806. X
  807. Xdevquery -- gives information about the device.
  808. X
  809. Xconfigure -- configure a SANA-II device.  This can only be succesfully done
  810. Xonce, but must be done before the SANA-II device is used for anything other
  811. Xthan devquery.  This program accepts as an argument a user-override for the
  812. Xhardware address (though not all devices will respond to this "override").
  813. X
  814. Xglobstats -- print global statistics from the SANA-II device.
  815. X
  816. Xtypestats -- ask SANA-II device to keep statistics on a particular type of
  817. Xpacket and print said statistics gathered by the device.  It defaults to
  818. Xgathering ten seconds of statistics, but a command line argument may change
  819. Xthis default.
  820. X
  821. Xwaitforonline -- wait until a SANA-II device comes online.  Really just for
  822. Xtesting this functionality in a driver.
  823. X
  824. Xonline -- put an offline SANA-II device online.  Really just for
  825. Xtesting this functionality in a driver.
  826. X
  827. Xoffline -- put an online SANA-II device offline.  Really just for
  828. Xtesting this functionality in a driver.
  829. X
  830. END_OF_FILE
  831. if test 2190 -ne `wc -c <'examples/readme'`; then
  832.     echo shar: \"'examples/readme'\" unpacked with wrong size!
  833. fi
  834. # end of 'examples/readme'
  835. fi
  836. if test ! -d 'examples/skeleton' ; then
  837.     echo shar: Creating directory \"'examples/skeleton'\"
  838.     mkdir 'examples/skeleton'
  839. fi
  840. if test -f 'examples/skeleton/skeleton.c' -a "${1}" != "-c" ; then 
  841.   echo shar: Will not clobber existing file \"'examples/skeleton/skeleton.c'\"
  842. else
  843. echo shar: Extracting \"'examples/skeleton/skeleton.c'\" \(1472 characters\)
  844. sed "s/^X//" >'examples/skeleton/skeleton.c' <<'END_OF_FILE'
  845. X/*
  846. X**  $Id: skeleton.c,v 1.2 91/11/08 10:47:58 dlarson Exp $
  847. X**
  848. X**  SANA-II driver utility skeleton functions.
  849. X**
  850. X**  Copyright 1991 Commodore-Amiga, Inc.
  851. X**
  852. X**  This code may be modified and used freely on Amiga computers.
  853. X**
  854. X*/
  855. X
  856. X
  857. X#include "skeleton.h"
  858. X
  859. Xint initdev(void)
  860. X{
  861. Xchar device[80];
  862. Xchar buff[80];
  863. XLONG unit;
  864. Xstruct TagItem MyTags[2];
  865. X
  866. X    printf("Device name to open:  ");
  867. X    if(GetVar("SANA2.Device", device, 80, 0) == -1)
  868. X        scanf("%s", device);
  869. X    else
  870. X        printf("%s\n", device);
  871. X    printf("Unit number to open:  ");
  872. X    if(GetVar("SANA2.Unit", buff, 80, 0) == -1)
  873. X        scanf("%d", &unit);
  874. X    else
  875. X    {
  876. X        sscanf(buff, "%ld", &unit);
  877. X        printf("%ld\n", unit);
  878. X    }
  879. X    printf("\n");
  880. X
  881. X    if ( !(DevPort = CreateMsgPort()) )
  882. X    {
  883. X        printf("Could not allocate port.\n");
  884. X        return(0);
  885. X    }
  886. X
  887. X    if (!(IOB1 = CreateIORequest(DevPort, sizeof(struct IOSana2Req))))
  888. X    {
  889. X        printf("Could not allocate extio block.\n");
  890. X        return(0);
  891. X    }
  892. X
  893. X    MyTags[0].ti_Tag = S2_CopyToBuff;
  894. X    MyTags[0].ti_Data = (ULONG) CopyToBuff;
  895. X    MyTags[1].ti_Tag = S2_CopyFromBuff;
  896. X    MyTags[1].ti_Data = (ULONG) CopyFromBuff;
  897. X    IOB1->ios2_BufferManagement = MyTags;
  898. X
  899. X    if (OpenDevice(device, unit, IOB1, 0))
  900. X    {
  901. X        printf("Could not open device.\n");
  902. X        return(0);
  903. X    }
  904. X
  905. X    DeviceOpen = 1;
  906. X    DevBits = 1L << DevPort->mp_SigBit;
  907. X    return(1);
  908. X}
  909. X
  910. X
  911. Xvoid closedev(void)
  912. X{
  913. X    if(DeviceOpen)
  914. X    {
  915. X        printf("\nAttempting To Close Unit.\n");
  916. X        CloseDevice(IOB1);
  917. X        printf("Closed.\n");
  918. X    }
  919. X    if(IOB1)
  920. X        DeleteIORequest(IOB1);
  921. X    if(DevPort)
  922. X        DeleteMsgPort(DevPort);
  923. X}
  924. END_OF_FILE
  925. if test 1472 -ne `wc -c <'examples/skeleton/skeleton.c'`; then
  926.     echo shar: \"'examples/skeleton/skeleton.c'\" unpacked with wrong size!
  927. fi
  928. # end of 'examples/skeleton/skeleton.c'
  929. fi
  930. if test -f 'examples/skeleton/skeleton.h' -a "${1}" != "-c" ; then 
  931.   echo shar: Will not clobber existing file \"'examples/skeleton/skeleton.h'\"
  932. else
  933. echo shar: Extracting \"'examples/skeleton/skeleton.h'\" \(954 characters\)
  934. sed "s/^X//" >'examples/skeleton/skeleton.h' <<'END_OF_FILE'
  935. X/*
  936. X**  $Id: skeleton.h,v 1.1 91/10/29 11:51:20 dlarson Exp $
  937. X**
  938. X**  SANA-II driver utility skeleton header.
  939. X**
  940. X**  Copyright 1991 Commodore-Amiga, Inc.
  941. X**
  942. X**  This code may be modified and used freely on Amiga computers.
  943. X**
  944. X*/
  945. X
  946. X#include <exec/types.h>
  947. X#include <exec/libraries.h>
  948. X#include <exec/memory.h>
  949. X#include <libraries/dos.h>
  950. X#include <pragmas/exec_pragmas.h>
  951. X#include <clib/exec_protos.h>
  952. X#include <devices/sana2.h>
  953. X
  954. X/*
  955. X**  globals
  956. X*/
  957. Xextern struct Library *SysBase;
  958. Xextern struct MsgPort *DevPort;
  959. Xextern struct IOSana2Req *IOB1;
  960. Xextern int    DeviceOpen;
  961. Xextern long   DevBits;
  962. X/*
  963. X**  prototypes
  964. X*/
  965. Xint initdev(void);
  966. Xvoid closedev(void);
  967. XBOOL CopyToBuff(VOID *in, VOID *out, LONG n);
  968. XBOOL CopyFromBuff(VOID *in, VOID *out, LONG n);
  969. X
  970. X/*
  971. X**  To make life easy on non-sending/receiving utilities
  972. X*/
  973. X#ifdef NOBUFFS
  974. XBOOL CopyToBuff(void *foo, void *bar, long n){return(FALSE);}
  975. XBOOL CopyFromBuff(void *foo, void *bar, long n){return(FALSE);}
  976. X#endif
  977. END_OF_FILE
  978. if test 954 -ne `wc -c <'examples/skeleton/skeleton.h'`; then
  979.     echo shar: \"'examples/skeleton/skeleton.h'\" unpacked with wrong size!
  980. fi
  981. # end of 'examples/skeleton/skeleton.h'
  982. fi
  983. if test ! -d 'examples/typestats' ; then
  984.     echo shar: Creating directory \"'examples/typestats'\"
  985.     mkdir 'examples/typestats'
  986. fi
  987. if test -f 'examples/typestats/lmkfile' -a "${1}" != "-c" ; then 
  988.   echo shar: Will not clobber existing file \"'examples/typestats/lmkfile'\"
  989. else
  990. echo shar: Extracting \"'examples/typestats/lmkfile'\" \(259 characters\)
  991. sed "s/^X//" >'examples/typestats/lmkfile' <<'END_OF_FILE'
  992. XINCFLAGS = -isana2:include
  993. XCLIB   = lib:lc.lib lib:amiga.lib lib:debug.lib
  994. X
  995. Xall: typestats
  996. X
  997. Xtypestats: typestats.o /skeleton/skeleton.o
  998. X    blink FROM lib:c.o $@.o /skeleton/skeleton.o TO $@ LIB $(CLIB)
  999. X
  1000. X
  1001. X#NO STACK CHECKING!!!
  1002. X.c.o:
  1003. X    lc $(INCFLAGS) -v -csuq $*
  1004. X
  1005. END_OF_FILE
  1006. if test 259 -ne `wc -c <'examples/typestats/lmkfile'`; then
  1007.     echo shar: \"'examples/typestats/lmkfile'\" unpacked with wrong size!
  1008. fi
  1009. # end of 'examples/typestats/lmkfile'
  1010. fi
  1011. if test -f 'examples/typestats/typestats.c' -a "${1}" != "-c" ; then 
  1012.   echo shar: Will not clobber existing file \"'examples/typestats/typestats.c'\"
  1013. else
  1014. echo shar: Extracting \"'examples/typestats/typestats.c'\" \(2450 characters\)
  1015. sed "s/^X//" >'examples/typestats/typestats.c' <<'END_OF_FILE'
  1016. X/*
  1017. X**  $Id: typestats.c,v 1.5 91/11/13 11:17:08 dlarson Exp $
  1018. X**
  1019. X**  SANA-II driver utility -- Gather and print stats for one type of packet.
  1020. X**                  (Over a specified period of time.)
  1021. X**
  1022. X**  Copyright 1991 Commodore-Amiga, Inc.
  1023. X**
  1024. X**  This code may be modified and used freely on Amiga computers.
  1025. X**
  1026. X*/
  1027. X
  1028. X#define NOBUFFS 1
  1029. X#include "/skeleton/skeleton.h"
  1030. X#include <stdio.h>
  1031. X
  1032. Xstruct MsgPort   *DevPort = NULL;
  1033. Xstruct IOSana2Req *IOB1    = NULL;
  1034. Xstruct Sana2PacketTypeStats Stats;
  1035. X
  1036. Xint    DeviceOpen = 0;
  1037. Xlong   DevBits;
  1038. X
  1039. XUSHORT PacketType = 0x6003;
  1040. X
  1041. Xvoid GetTypeStats();
  1042. Xvoid PrintStats();
  1043. X
  1044. X
  1045. Xmain(argc , argv)
  1046. Xchar *argv[];
  1047. X{
  1048. Xint ticks = 500;
  1049. X
  1050. X    if(!initdev())
  1051. X    {
  1052. X        printf("Open Failed\n");
  1053. X        goto bottom;
  1054. X    }
  1055. X    if (argc > 1)
  1056. X        PacketType = atoi(argv[1]);
  1057. X    if (argc > 2)
  1058. X        ticks = atoi(argv[2]);
  1059. X    printf("Tracking Packet Type: 0x%lx\n" , PacketType);
  1060. X    IOB1->ios2_PacketType = PacketType;
  1061. X    if (TrackType())
  1062. X    {
  1063. X        printf("could not track type: 0x%lx\n" , PacketType);
  1064. X        goto bottom;
  1065. X    }
  1066. X    printf("Waiting for %ld seconds.\n\n", ticks/50);
  1067. X    Delay(ticks);
  1068. X    GetTypeStats();
  1069. X    if (!IOB1->ios2_Req.io_Error)
  1070. X        PrintStats();
  1071. X    else
  1072. X        printf("Error Returned: %ld WireError: %ld\n" , IOB1->ios2_Req.io_Error , IOB1->ios2_WireError);
  1073. Xbottom:    UnTrackType();
  1074. X    closedev();
  1075. X}
  1076. X
  1077. XTrackType()
  1078. X{
  1079. X    IOB1->ios2_Req.io_Error   = 0;
  1080. X    IOB1->ios2_Req.io_Flags   = IOF_QUICK;
  1081. X    IOB1->ios2_Req.io_Command = S2_TRACKTYPE;
  1082. X    DoIO(IOB1);
  1083. X    if (IOB1->ios2_Req.io_Error) {
  1084. X        printf("TRACKTYPE Error: %ld WireError: %ld\n" , (long) IOB1->ios2_Req.io_Error , IOB1->ios2_WireError);
  1085. X        return(1);
  1086. X    }
  1087. X    return(0);
  1088. X}
  1089. X
  1090. XUnTrackType()
  1091. X{
  1092. X    IOB1->ios2_Req.io_Error   = 0;
  1093. X    IOB1->ios2_Req.io_Flags   = IOF_QUICK;
  1094. X    IOB1->ios2_Req.io_Command = S2_UNTRACKTYPE;
  1095. X    DoIO(IOB1);
  1096. X    if (IOB1->ios2_Req.io_Error) {
  1097. X        printf("UNTRACKTYPE Error: %ld WireError: %ld\n" , (long) IOB1->ios2_Req.io_Error , IOB1->ios2_WireError);
  1098. X        return(1);
  1099. X    }
  1100. X    return(0);
  1101. X}
  1102. X
  1103. Xvoid GetTypeStats()
  1104. X{
  1105. X    IOB1->ios2_Req.io_Error   = 0;
  1106. X    IOB1->ios2_Req.io_Flags   = IOF_QUICK;
  1107. X    IOB1->ios2_Req.io_Command = S2_GETTYPESTATS;
  1108. X    IOB1->ios2_StatData = &Stats;
  1109. X    DoIO(IOB1);
  1110. X}
  1111. X
  1112. Xvoid PrintStats()
  1113. X{
  1114. X    printf("Packet Type:       0x%lx\n", (long) PacketType);
  1115. X    printf("Packets Received:    %d\n" , Stats.PacketsReceived);
  1116. X    printf("Packets Transmitted: %d\n" , Stats.PacketsSent);
  1117. X    printf("Bytes Received:      %d\n" , Stats.BytesReceived);
  1118. X    printf("Bytes Transmitted:   %d\n" , Stats.BytesSent);
  1119. X    printf("Packets Dropped:     %d\n" , Stats.PacketsDropped);
  1120. X}
  1121. END_OF_FILE
  1122. if test 2450 -ne `wc -c <'examples/typestats/typestats.c'`; then
  1123.     echo shar: \"'examples/typestats/typestats.c'\" unpacked with wrong size!
  1124. fi
  1125. # end of 'examples/typestats/typestats.c'
  1126. fi
  1127. if test ! -d 'examples/waitforonline' ; then
  1128.     echo shar: Creating directory \"'examples/waitforonline'\"
  1129.     mkdir 'examples/waitforonline'
  1130. fi
  1131. if test -f 'examples/waitforonline/lmkfile' -a "${1}" != "-c" ; then 
  1132.   echo shar: Will not clobber existing file \"'examples/waitforonline/lmkfile'\"
  1133. else
  1134. echo shar: Extracting \"'examples/waitforonline/lmkfile'\" \(271 characters\)
  1135. sed "s/^X//" >'examples/waitforonline/lmkfile' <<'END_OF_FILE'
  1136. XINCFLAGS = -isana2:include
  1137. XCLIB   = lib:lc.lib lib:amiga.lib lib:debug.lib
  1138. X
  1139. Xall: waitforonline
  1140. X
  1141. Xwaitforonline: waitforonline.o /skeleton/skeleton.o
  1142. X    blink FROM lib:c.o $@.o /skeleton/skeleton.o TO $@ LIB $(CLIB)
  1143. X
  1144. X
  1145. X#NO STACK CHECKING!!!
  1146. X.c.o:
  1147. X    lc $(INCFLAGS) -v -csuq $*
  1148. X
  1149. END_OF_FILE
  1150. if test 271 -ne `wc -c <'examples/waitforonline/lmkfile'`; then
  1151.     echo shar: \"'examples/waitforonline/lmkfile'\" unpacked with wrong size!
  1152. fi
  1153. # end of 'examples/waitforonline/lmkfile'
  1154. fi
  1155. if test -f 'examples/waitforonline/waitforonline.c' -a "${1}" != "-c" ; then 
  1156.   echo shar: Will not clobber existing file \"'examples/waitforonline/waitforonline.c'\"
  1157. else
  1158. echo shar: Extracting \"'examples/waitforonline/waitforonline.c'\" \(996 characters\)
  1159. sed "s/^X//" >'examples/waitforonline/waitforonline.c' <<'END_OF_FILE'
  1160. X/*
  1161. X**  $Id: waitforonline.c,v 1.2 91/11/13 11:15:04 dlarson Exp $
  1162. X**
  1163. X**  SANA-II driver utility -- Wait for a driver to come online.
  1164. X**                  (No wait if driver already online.)
  1165. X**
  1166. X**  Copyright 1991 Commodore-Amiga, Inc.
  1167. X**
  1168. X**  This code may be modified and used freely on Amiga computers.
  1169. X**
  1170. X*/
  1171. X
  1172. X
  1173. X#define NOBUFFS 1
  1174. X#include "/skeleton/skeleton.h"
  1175. X
  1176. Xstruct MsgPort   *DevPort = NULL;
  1177. Xstruct IOSana2Req *IOB1    = NULL;
  1178. X
  1179. Xint    DeviceOpen = 0;
  1180. Xlong   DevBits;
  1181. X
  1182. Xvoid WaitForOnLine();
  1183. X
  1184. Xmain(argc , argv)
  1185. Xchar *argv[];
  1186. X{
  1187. X    if(!initdev())
  1188. X        printf("Open Failed\n");
  1189. X    else
  1190. X    {
  1191. X        printf("Waiting For OnLine\n");
  1192. X        WaitForOnLine();
  1193. X        if(IOB1->ios2_Req.io_Error)
  1194. X            printf("ERROR CODE: 0x%lx\n",
  1195. X                (long)IOB1->ios2_Req.io_Error);
  1196. X        else
  1197. X            printf("OnLine Occurred - No Error\n");
  1198. X    }
  1199. Xbottom:    closedev();
  1200. X}
  1201. X
  1202. Xvoid WaitForOnLine()
  1203. X{
  1204. X    IOB1->ios2_Req.io_Error     = 0;
  1205. X    IOB1->ios2_Req.io_Flags     = IOF_QUICK;
  1206. X    IOB1->ios2_Req.io_Command   = S2_ONEVENT;
  1207. X    IOB1->ios2_WireError = S2EVENT_ONLINE;
  1208. X    DoIO(IOB1);
  1209. X}
  1210. END_OF_FILE
  1211. if test 996 -ne `wc -c <'examples/waitforonline/waitforonline.c'`; then
  1212.     echo shar: \"'examples/waitforonline/waitforonline.c'\" unpacked with wrong size!
  1213. fi
  1214. # end of 'examples/waitforonline/waitforonline.c'
  1215. fi
  1216. if test ! -d 'include' ; then
  1217.     echo shar: Creating directory \"'include'\"
  1218.     mkdir 'include'
  1219. fi
  1220. if test ! -d 'include/devices' ; then
  1221.     echo shar: Creating directory \"'include/devices'\"
  1222.     mkdir 'include/devices'
  1223. fi
  1224. if test -f 'include/devices/sana2.h' -a "${1}" != "-c" ; then 
  1225.   echo shar: Will not clobber existing file \"'include/devices/sana2.h'\"
  1226. else
  1227. echo shar: Extracting \"'include/devices/sana2.h'\" \(7276 characters\)
  1228. sed "s/^X//" >'include/devices/sana2.h' <<'END_OF_FILE'
  1229. X#ifndef SANA2_SANA2DEVICE_H
  1230. X#define SANA2_SANA2DEVICE_H 1
  1231. X/*
  1232. X**    $Id: sana2.h,v 1.4 91/11/07 11:34:41 dlarson Exp $
  1233. X**
  1234. X**    Structure definitions for SANA-II devices.
  1235. X**
  1236. X**    (C) Copyright 1991 Commodore-Amiga Inc.
  1237. X**        All Rights Reserved
  1238. X*/
  1239. X
  1240. X
  1241. X#ifndef EXEC_TYPES_H
  1242. X#include <exec/types.h>
  1243. X#endif
  1244. X
  1245. X#ifndef EXEC_PORTS_H
  1246. X#include <exec/ports.h>
  1247. X#endif
  1248. X
  1249. X#ifndef EXEC_IO_H
  1250. X#include <exec/io.h>
  1251. X#endif
  1252. X
  1253. X#ifndef EXEC_ERRORS_H
  1254. X#include <exec/errors.h>
  1255. X#endif
  1256. X
  1257. X#ifndef DEVICES_TIMER_H
  1258. X#include <devices/timer.h>
  1259. X#endif
  1260. X
  1261. X#ifndef UTILITY_TAGITEM_H
  1262. X#include <utility/tagitem.h>
  1263. X#endif
  1264. X
  1265. X
  1266. X#define SANA2_MAX_ADDR_BITS    (128)
  1267. X#define SANA2_MAX_ADDR_BYTES    ((SANA2_MAX_ADDR_BITS+7)/8)
  1268. X
  1269. Xstruct IOSana2Req
  1270. X{
  1271. X    struct IORequest ios2_Req;
  1272. X    ULONG ios2_WireError;        /* wire type specific error    */
  1273. X    ULONG ios2_PacketType;        /* packet type            */
  1274. X    UBYTE ios2_SrcAddr[SANA2_MAX_ADDR_BYTES];    /* source addr    */
  1275. X    UBYTE ios2_DstAddr[SANA2_MAX_ADDR_BYTES];    /* dest address    */
  1276. X    ULONG ios2_DataLength;        /* length of packet data    */
  1277. X    VOID *ios2_Data;        /* packet data            */
  1278. X    VOID *ios2_StatData;        /* statics data pointer        */
  1279. X    VOID *ios2_BufferManagement;    /* see SANA-II OpenDevice adoc    */
  1280. X};
  1281. X
  1282. X
  1283. X/*
  1284. X** defines for the ios2_Flags field
  1285. X*/
  1286. X#define SANA2IOB_RAW    (7)        /* raw packet IO requested    */
  1287. X#define SANA2IOF_RAW    (1<<SANA2IOB_RAW)
  1288. X
  1289. X#define    SANA2IOB_BCAST    (6)        /* broadcast packet (received)    */
  1290. X#define    SANA2IOF_BCAST    (1<<SANA2IOB_BCAST)
  1291. X
  1292. X#define    SANA2IOB_MCAST    (5)        /* multicast packet (received)    */
  1293. X#define    SANA2IOF_MCAST    (1<<SANA2IOB_MCAST)
  1294. X
  1295. X#define SANA2IOB_QUICK    (IOB_QUICK)    /* quick IO requested (0)    */
  1296. X#define SANA2IOF_QUICK    (IOF_QUICK)
  1297. X
  1298. X
  1299. X/*
  1300. X** defines for OpenDevice() flags
  1301. X*/
  1302. X#define SANA2OPB_MINE    (0)        /* exclusive access requested    */
  1303. X#define SANA2OPF_MINE    (1<<SANA2OPB_MINE)
  1304. X
  1305. X#define SANA2OPB_PROM    (1)        /* promiscuous mode requested    */
  1306. X#define SANA2OPF_PROM    (1<<SANA2OPB_PROM)
  1307. X
  1308. X
  1309. X/*
  1310. X** defines for OpenDevice() tags
  1311. X*/
  1312. X#define S2_Dummy    (TAG_USER + 0xB0000)
  1313. X
  1314. X#define S2_CopyToBuff    (S2_Dummy + 1)
  1315. X#define S2_CopyFromBuff    (S2_Dummy + 2)
  1316. X
  1317. X
  1318. Xstruct Sana2DeviceQuery
  1319. X{
  1320. X/*
  1321. X** Standard information
  1322. X*/
  1323. X    ULONG    SizeAvailable;        /* bytes available        */
  1324. X    ULONG    SizeSupplied;        /* bytes supplied        */
  1325. X    ULONG    DevQueryFormat;        /* this is type 0        */
  1326. X    ULONG    DeviceLevel;        /* this document is level 0    */
  1327. X/*
  1328. X** Common information
  1329. X*/
  1330. X    UWORD    AddrFieldSize;        /* address size in bits        */
  1331. X    ULONG    MTU;            /* maximum packet data size    */
  1332. X    ULONG    BPS;            /* line rate (bits/sec)        */
  1333. X    ULONG    HardwareType;        /* what the wire is        */
  1334. X/*
  1335. X** Format specific information
  1336. X*/
  1337. X};
  1338. X
  1339. X
  1340. X/*
  1341. X** defined Hardware types
  1342. X**
  1343. X**  If your hardware type isn't listed below contact CATS to get a new
  1344. X**  type number added for your hardware.
  1345. X*/
  1346. X
  1347. X#define S2WireType_Ethernet        1
  1348. X#define S2WireType_IEEE802        6
  1349. X#define S2WireType_Arcnet        7
  1350. X#define S2WireType_LocalTalk        11
  1351. X
  1352. X#define S2WireType_PPP            253
  1353. X#define S2WireType_SLIP            254
  1354. X#define S2WireType_CSLIP        255
  1355. X
  1356. X
  1357. Xstruct Sana2PacketTypeStats
  1358. X{
  1359. X    ULONG PacketsSent;        /* transmitted count        */
  1360. X    ULONG PacketsReceived;        /* received count        */
  1361. X    ULONG BytesSent;        /* bytes transmitted count    */
  1362. X    ULONG BytesReceived;        /* bytes received count        */
  1363. X    ULONG PacketsDropped;        /* packets dropped count    */
  1364. X};
  1365. X
  1366. X
  1367. Xstruct Sana2SpecialStatRecord
  1368. X{
  1369. X    ULONG Type;            /* statistic identifier        */
  1370. X    ULONG Count;            /* the statistic        */
  1371. X    char *String;            /* statistic name        */
  1372. X};
  1373. X
  1374. X
  1375. Xstruct Sana2SpecialStatHeader
  1376. X{
  1377. X    ULONG RecordCountMax;        /* room available        */
  1378. X    ULONG RecordCountSupplied;    /* number supplied        */
  1379. X    /* struct Sana2SpecialStatRecord[RecordCountMax]; */
  1380. X};
  1381. X
  1382. X
  1383. Xstruct Sana2DeviceStats
  1384. X{
  1385. X    ULONG PacketsReceived;        /* received count        */
  1386. X    ULONG PacketsSent;        /* transmitted count        */
  1387. X    ULONG BadData;            /* bad packets received        */
  1388. X    ULONG Overruns;            /* hardware miss count        */
  1389. X    ULONG UnknownTypesReceived;    /* orphan count            */
  1390. X    ULONG Reconfigurations;        /* network reconfigurations    */
  1391. X    struct timeval LastStart;    /* time of last online        */
  1392. X};
  1393. X
  1394. X
  1395. X/*
  1396. X** Device Commands
  1397. X*/
  1398. X#define S2_START        (CMD_NONSTD)
  1399. X
  1400. X#define S2_DEVICEQUERY        (S2_START+ 0)
  1401. X#define S2_GETSTATIONADDRESS    (S2_START+ 1)
  1402. X#define S2_CONFIGINTERFACE    (S2_START+ 2)
  1403. X#define S2_ADDSTATIONALIAS    (S2_START+ 3)
  1404. X#define S2_DELSTATIONALIAS    (S2_START+ 4)
  1405. X#define S2_ADDMULTICASTADDRESS    (S2_START+ 5)
  1406. X#define S2_DELMULTICASTADDRESS    (S2_START+ 6)
  1407. X#define S2_MULTICAST        (S2_START+ 7)
  1408. X#define S2_BROADCAST        (S2_START+ 8)
  1409. X#define S2_TRACKTYPE        (S2_START+ 9)
  1410. X#define S2_UNTRACKTYPE        (S2_START+10)
  1411. X#define S2_GETTYPESTATS        (S2_START+11)
  1412. X#define S2_GETSPECIALSTATS    (S2_START+12)
  1413. X#define S2_GETGLOBALSTATS    (S2_START+13)
  1414. X#define S2_ONEVENT        (S2_START+14)
  1415. X#define S2_READORPHAN        (S2_START+15)
  1416. X#define S2_ONLINE        (S2_START+16)
  1417. X#define S2_OFFLINE        (S2_START+17)
  1418. X
  1419. X#define S2_END            (S2_START+18)
  1420. X
  1421. X
  1422. X/*
  1423. X** defined errors for ios2_Error  (see also <exec/errors.h>)
  1424. X*/
  1425. X#define S2ERR_NO_ERROR        0    /* peachy-keen            */
  1426. X#define S2ERR_NO_RESOURCES    1    /* resource allocation failure    */
  1427. X#define S2ERR_BAD_ARGUMENT    3    /* garbage somewhere        */
  1428. X#define S2ERR_BAD_STATE        4    /* inappropriate state        */
  1429. X#define S2ERR_BAD_ADDRESS    5    /* who?                */
  1430. X#define    S2ERR_MTU_EXCEEDED    6    /* too much to chew        */
  1431. X#define S2ERR_NOT_SUPPORTED    8    /* hardware can't support cmd    */
  1432. X#define S2ERR_SOFTWARE        9    /* software error detected    */
  1433. X#define S2ERR_OUTOFSERVICE    10    /* driver is OFFLINE        */
  1434. X/*
  1435. X** From <exec/errors.h>
  1436. X**
  1437. X**    IOERR_OPENFAIL     (-1) * device/unit failed to open *
  1438. X**    IOERR_ABORTED     (-2) * request terminated early [after AbortIO()] *
  1439. X**    IOERR_NOCMD     (-3) * command not supported by device *
  1440. X**    IOERR_BADLENGTH     (-4) * not a valid length (usually IO_LENGTH) *
  1441. X**    IOERR_BADADDRESS (-5) * invalid address (misaligned or bad range) *
  1442. X**    IOERR_UNITBUSY     (-6) * device opens ok, but requested unit is busy *
  1443. X**    IOERR_SELFTEST   (-7) * hardware failed self-test *
  1444. X*/
  1445. X
  1446. X/*
  1447. X** defined errors for ios2_WireError
  1448. X*/
  1449. X#define S2WERR_GENERIC_ERROR    0    /* no specific info available    */
  1450. X#define    S2WERR_NOT_CONFIGURED    1    /* unit not configured        */
  1451. X#define S2WERR_UNIT_ONLINE    2    /* unit is currently online    */
  1452. X#define S2WERR_UNIT_OFFLINE    3    /* unit is currently offline    */
  1453. X#define    S2WERR_ALREADY_TRACKED    4    /* protocol already tracked    */
  1454. X#define    S2WERR_NOT_TRACKED    5    /* protocol not tracked        */
  1455. X#define S2WERR_BUFF_ERROR    6    /* buff mgt func returned error    */
  1456. X#define S2WERR_SRC_ADDRESS    7    /* source address problem    */
  1457. X#define S2WERR_DST_ADDRESS    8    /* destination address problem    */
  1458. X#define S2WERR_BAD_BROADCAST    9    /* broadcast address problem    */
  1459. X#define S2WERR_BAD_MULTICAST    10    /* multicast address problem    */
  1460. X#define S2WERR_MULTICAST_FULL    11    /* multicast address list full    */
  1461. X#define S2WERR_BAD_EVENT    12    /* unsupported event class      */
  1462. X#define S2WERR_BAD_STATDATA    13    /* statdata failed sanity check */
  1463. X#define S2WERR_IS_CONFIGURED    15    /* attempt to config twice      */
  1464. X#define S2WERR_NULL_POINTER    16    /* null pointer detected        */
  1465. X
  1466. X
  1467. X/*
  1468. X** defined events
  1469. X*/
  1470. X#define    S2EVENT_ERROR        (1L<<0)    /* error catch all        */
  1471. X#define    S2EVENT_TX        (1L<<1)    /* transmitter error catch all    */
  1472. X#define    S2EVENT_RX        (1L<<2)    /* receiver error catch all    */
  1473. X#define    S2EVENT_ONLINE        (1L<<3)    /* unit is in service        */
  1474. X#define    S2EVENT_OFFLINE        (1L<<4)    /* unit is not in service    */
  1475. X#define    S2EVENT_BUFF        (1L<<5)    /* buff mgt function error    */
  1476. X#define S2EVENT_HARDWARE    (1L<<6)    /* hardware error catch all    */
  1477. X#define S2EVENT_SOFTWARE    (1L<<7)    /* software error catch all    */
  1478. X
  1479. X
  1480. X#endif    /* SANA2_SANA2DEVICE_H */
  1481. END_OF_FILE
  1482. if test 7276 -ne `wc -c <'include/devices/sana2.h'`; then
  1483.     echo shar: \"'include/devices/sana2.h'\" unpacked with wrong size!
  1484. fi
  1485. # end of 'include/devices/sana2.h'
  1486. fi
  1487. if test -f 'include/devices/sana2.i' -a "${1}" != "-c" ; then 
  1488.   echo shar: Will not clobber existing file \"'include/devices/sana2.i'\"
  1489. else
  1490. echo shar: Extracting \"'include/devices/sana2.i'\" \(7920 characters\)
  1491. sed "s/^X//" >'include/devices/sana2.i' <<'END_OF_FILE'
  1492. X        IFND    SANA2_SANA2DEVICE_I
  1493. XSANA2_SANA2DEVICE_I     SET     1
  1494. X**
  1495. X**      $Id: sana2.i,v 1.7 91/11/12 14:24:45 dlarson Exp $
  1496. X**
  1497. X**      Structure definitions for SANA-II devices.
  1498. X**
  1499. X**      (C) Copyright 1991 Commodore-Amiga Inc.
  1500. X**              All Rights Reserved
  1501. X**
  1502. X
  1503. X
  1504. X        IFND    EXEC_TYPES_I
  1505. X        INCLUDE "exec/types.i"
  1506. X        ENDC
  1507. X
  1508. X        IFND    EXEC_PORTS_I
  1509. X        INCLUDE "exec/ports.i"
  1510. X        ENDC
  1511. X
  1512. X        IFND    EXEC_IO_I
  1513. X        INCLUDE "exec/io.i"
  1514. X        ENDC
  1515. X
  1516. X        IFND    EXEC_ERRORS_I
  1517. X        INCLUDE "exec/errors.i"
  1518. X        ENDC
  1519. X
  1520. X        IFND    DEVICES_TIMER_I
  1521. X        INCLUDE "devices/timer.i"
  1522. X        ENDC
  1523. X
  1524. X        IFND    UTILITY_TAGITEM_I
  1525. X        INCLUDE "utility/tagitem.i"
  1526. X        ENDC
  1527. X
  1528. X
  1529. XSANA2_MAX_ADDR_BITS     EQU     128
  1530. XSANA2_MAX_ADDR_BYTES    EQU     ((SANA2_MAX_ADDR_BITS+7)/8)
  1531. X
  1532. X
  1533. X STRUCTURE IOSana2Req,0
  1534. X        STRUCT  IOS2_REQ,IO_SIZE
  1535. X        ULONG   IOS2_WIREERROR          ; wire type specific error
  1536. X        ULONG   IOS2_PACKETTYPE         ; packet type
  1537. X        STRUCT  IOS2_SRCADDR,SANA2_MAX_ADDR_BYTES       ; source address
  1538. X        STRUCT  IOS2_DSTADDR,SANA2_MAX_ADDR_BYTES       ; dest address
  1539. X        ULONG   IOS2_DATALENGTH         ; length of packet data
  1540. X        APTR    IOS2_DATA               ; packet data (not touched by driver!)
  1541. X        APTR    IOS2_STATDATA           ; statics data pointer
  1542. X        APTR    IOS2_BUFFERMANAGEMENT   ; see SANA-II OpenDevice adoc
  1543. X
  1544. X        LABEL   IOS2_SIZE
  1545. X
  1546. X
  1547. X;
  1548. X; equates for the IOS2_FLAGS field
  1549. X;
  1550. X
  1551. XSANA2IOB_RAW    EQU     7               ; raw packet IO requested
  1552. XSANA2IOF_RAW    EQU     (1<<SANA2IOB_RAW)
  1553. X
  1554. XSANA2IOB_BCAST  EQU     6               ; broadcast packet (received)
  1555. XSANA2IOF_BCAST  EQU     (1<<SANA2IOB_BCAST)
  1556. X
  1557. XSANA2IOB_MCAST  EQU     5               ; multicast packet (received)
  1558. XSANA2IOF_MCAST  EQU     (1<<SANA2IOB_MCAST)
  1559. X
  1560. XSANA2IOB_QUICK  EQU     IOB_QUICK       ; quick IO requested (0)
  1561. XSANA2IOF_QUICK  EQU     IOF_QUICK
  1562. X
  1563. X
  1564. X;
  1565. X; equates for OpenDevice()
  1566. X;
  1567. X
  1568. XSANA2OPB_MINE   EQU     0               ; exclusive access requested
  1569. XSANA2OPF_MINE   EQU     (1<<SANA2OPB_MINE)
  1570. X
  1571. XSANA2OPB_PROM   EQU     1               ; promiscuous mode requested
  1572. XSANA2OPF_PROM   EQU     (1<<SANA2OPB_PROM)
  1573. X
  1574. XS2_Dummy        EQU     (TAG_USER+$B0000)
  1575. XS2_COPYTOBUFF   EQU     S2_Dummy+1
  1576. XS2_COPYFROMBUFF EQU     S2_Dummy+2
  1577. X
  1578. X STRUCTURE SANA2DEVICEQUERY,0
  1579. X        ; Standard information
  1580. X        ULONG   S2DQ_SIZEAVAILABLE      ; bytes available
  1581. X        ULONG   S2DQ_SIZESUPPLIED       ; bytes supplied
  1582. X        ULONG    S2DQ_FORMAT             ; this is type 0
  1583. X        ULONG    S2DQ_DEVICELEVEL        ; this document is level 0
  1584. X
  1585. X        ; Common information
  1586. X        UWORD   S2DQ_ADDRFIELDSIZE           ; address size in bits
  1587. X        ULONG   S2DQ_MTU                ; maximum packet data size
  1588. X        ULONG    S2DQ_BPS                ; line rate (bits/sec)
  1589. X        ULONG    S2DQ_HARDWARETYPE       ; what the wire is
  1590. X
  1591. X        ; Format specific information
  1592. X        LABEL   S2DQ_SIZE
  1593. X
  1594. X
  1595. X;
  1596. X; defined SANA-II hardware types
  1597. X;
  1598. X
  1599. XS2WIRETYPE_ETHERNET             EQU     1
  1600. XS2WIRETYPE_IEEE802              EQU     6
  1601. XS2WIRETYPE_ARCNET               EQU     7
  1602. XS2WIRETYPE_LOCALTALK            EQU     11
  1603. X
  1604. XS2WIRETYPE_PPP                  EQU     253
  1605. XS2WIRETYPE_SLIP                 EQU     254
  1606. XS2WIRETYPE_CSLIP                EQU     255
  1607. X
  1608. X
  1609. X STRUCTURE SANA2PACKETTYPESTATS,0
  1610. X        ULONG    S2PTS_TXPACKETS         ; transmitted count
  1611. X        ULONG    S2PTS_RXPACKETS         ; received count
  1612. X        ULONG    S2PTS_TXBYTES           ; bytes transmitted count
  1613. X        ULONG    S2PTS_RXBYTES           ; bytes received count
  1614. X        ULONG    S2PTS_PACKETSDROPPED    ; packets dropped count
  1615. X        LABEL   S2PTS_SIZE
  1616. X
  1617. X
  1618. X STRUCTURE SANA2SPECIALSTATRECORD,0
  1619. X        ULONG   S2SSR_TYPE              ; statistic identifier
  1620. X        ULONG    S2SSR_COUNT             ; the statistic
  1621. X        APTR    S2SSR_STRING            ; statistic name
  1622. X        LABEL   S2SSR_SIZE
  1623. X
  1624. X
  1625. X STRUCTURE SANA2SPECIALSTATHEADER,0
  1626. X        ULONG   S2SSH_RECORDCOUNTMAX            ; room available
  1627. X        ULONG   S2SSH_RECORDCOUNTSUPPLIED       ; number supplied
  1628. X        LABEL   S2SSH_SIZE
  1629. X
  1630. X
  1631. X STRUCTURE SANA2DEVICESTATS,0
  1632. X        ULONG    S2DS_PACKETSRECEIVED           ; received count
  1633. X        ULONG    S2DS_PACKETSSENT               ; transmitted count
  1634. X        ULONG    S2DS_BADDATA                   ; bad packets received
  1635. X        ULONG    S2DS_OVERRUNS                  ; hardware miss count
  1636. X        ULONG    S2DS_SOFTMISSES                ; software miss count
  1637. X        ULONG    S2DS_UNKNOWNTYPESRECEIVED      ; orphan count
  1638. X        ULONG    S2DS_RECONFIGURATIONS          ; network reconfigurations
  1639. X        STRUCT  S2DS_LASTSTART,TV_SIZE          ; time of last online
  1640. X        LABEL   S2DS_SIZE
  1641. X
  1642. X
  1643. X;
  1644. X; Device Commands
  1645. X;
  1646. X
  1647. XS2_START                EQU     (CMD_NONSTD)
  1648. X
  1649. XS2_DEVICEQUERY          EQU     (S2_START+0)
  1650. XS2_GETSTATIONADDRESS    EQU     (S2_START+1)
  1651. XS2_CONFIGINTERFACE      EQU     (S2_START+2)
  1652. XS2_ADDSTATIONALIAS      EQU     (S2_START+3)
  1653. XS2_DELSTATIONALIAS      EQU     (S2_START+4)
  1654. XS2_ADDMULTICASTADDRESS  EQU     (S2_START+5)
  1655. XS2_DELMULTICASTADDRESS  EQU     (S2_START+6)
  1656. XS2_MULTICAST            EQU     (S2_START+7)
  1657. XS2_BROADCAST            EQU     (S2_START+8)
  1658. XS2_TRACKTYPE            EQU     (S2_START+9)
  1659. XS2_UNTRACKTYPE          EQU     (S2_START+10)
  1660. XS2_GETTYPESTATS         EQU     (S2_START+11)
  1661. XS2_GETSPECIALSTATS      EQU     (S2_START+12)
  1662. XS2_GETGLOBALSTATS       EQU     (S2_START+13)
  1663. XS2_ONEVENT              EQU     (S2_START+14)
  1664. XS2_READORPHAN           EQU     (S2_START+15)
  1665. XS2_ONLINE               EQU     (S2_START+16)
  1666. XS2_OFFLINE              EQU     (S2_START+17)
  1667. X
  1668. XS2_END                  EQU     (S2_START+18)
  1669. X
  1670. X
  1671. X;
  1672. X; defined errors for IOS2_ERROR
  1673. X;
  1674. X
  1675. XS2ERR_NO_ERROR          EQU     0       ; peachy-keen
  1676. XS2ERR_NO_RESOURCES      EQU     1       ; resource allocation failure
  1677. XS2ERR_BAD_ARGUMENT      EQU     3       ; garbage somewhere
  1678. XS2ERR_BAD_STATE         EQU     4       ; inappropriate state
  1679. XS2ERR_BAD_ADDRESS       EQU     5       ; who?
  1680. XS2ERR_MTU_EXCEEDED      EQU     6       ; too much to chew
  1681. XS2ERR_NOT_SUPPORTED     EQU     8       ; command not supported by hardware
  1682. XS2ERR_SOFTWARE          EQU     9       ; software error detected
  1683. XS2ERR_OUTOFSERVICE    EQU    10    ; driver is offline
  1684. X;SEE ALSO <exec/errors.i>
  1685. X
  1686. X;
  1687. X; defined errors for IOS2_WIREERROR
  1688. X;
  1689. X
  1690. XS2WERR_GENERIC_ERROR    EQU     0       ; no specific info available
  1691. XS2WERR_NOT_CONFIGURED   EQU     1       ; unit not configured
  1692. XS2WERR_UNIT_ONLINE      EQU     2       ; unit is currently online
  1693. XS2WERR_UNIT_OFFLINE     EQU     3       ; unit is currently offline
  1694. XS2WERR_ALREADY_TRACKED  EQU     4       ; protocol already tracked
  1695. XS2WERR_NOT_TRACKED      EQU     5       ; protocol not tracked
  1696. XS2WERR_BUFF_ERROR       EQU     6       ; buffer mgmt func returned error
  1697. XS2WERR_SRC_ADDRESS      EQU     7       ; source address problem
  1698. XS2WERR_DST_ADDRESS      EQU     8       ; destination address problem
  1699. XS2WERR_BAD_BROADCAST    EQU     9       ; broadcast address problem
  1700. XS2WERR_BAD_MULTICAST    EQU     10      ; multicast address problem
  1701. XS2WERR_MULTICAST_FULL   EQU     11      ; multicast address list full
  1702. XS2WERR_BAD_EVENT        EQU     12      ; unsupported event class
  1703. XS2WERR_BAD_STATDATA     EQU     13      ; statdata failed sanity check
  1704. XS2WERR_IS_CONFIGURED    EQU     15      ; attempt to config twice
  1705. XS2WERR_NULL_POINTER     EQU     16      ; null pointer detected
  1706. X
  1707. X
  1708. X;
  1709. X; defined events
  1710. X;
  1711. X
  1712. XS2EVENT_ERROR       equ 1      ; error catch all
  1713. XS2EVENT_TX          equ 2      ; transmitter error catch all
  1714. XS2EVENT_RX          equ 4      ; receiver error catch all
  1715. XS2EVENT_ONLINE      equ 8      ; unit is in service
  1716. XS2EVENT_OFFLINE     equ 16     ; unit is not in service
  1717. XS2EVENT_BUFF        equ 32     ; buffer mgmt function error catch all
  1718. XS2EVENT_HARDWARE    equ 64     ; hardware error catch all
  1719. XS2EVENT_SOFTWARE    equ 128    ; software error catch all
  1720. X
  1721. X
  1722. X        ENDC    SANA2_SANA2DEVICE_I
  1723. END_OF_FILE
  1724. if test 7920 -ne `wc -c <'include/devices/sana2.i'`; then
  1725.     echo shar: \"'include/devices/sana2.i'\" unpacked with wrong size!
  1726. fi
  1727. # end of 'include/devices/sana2.i'
  1728. fi
  1729. if test -f 'include/devices/sana2specialstats.h' -a "${1}" != "-c" ; then 
  1730.   echo shar: Will not clobber existing file \"'include/devices/sana2specialstats.h'\"
  1731. else
  1732. echo shar: Extracting \"'include/devices/sana2specialstats.h'\" \(1206 characters\)
  1733. sed "s/^X//" >'include/devices/sana2specialstats.h' <<'END_OF_FILE'
  1734. X#ifndef SANA2_SANA2SPECIALSTATS_H
  1735. X#define SANA2_SANA2SPECIALSTATS_H 1
  1736. X/*
  1737. X**    $Id: sana2specialstats.h,v 1.2 91/10/17 12:59:47 dlarson Exp $
  1738. X**
  1739. X**    Defined ids for SANA-II special statistics.
  1740. X**
  1741. X**
  1742. X**    (C) Copyright 1991 Commodore-Amiga Inc.
  1743. X**        All Rights Reserved
  1744. X*/
  1745. X
  1746. X
  1747. X#ifndef SANA2_SANA2DEVICE_H
  1748. X#include <sana2/sana2device.h>
  1749. X#endif    /* !SANA2_SANA2DEVICE_H */
  1750. X
  1751. X
  1752. X/*
  1753. X** The SANA-II special statistic identifier is an unsigned 32 number.
  1754. X** The upper 16 bits identify the type of network wire type to which
  1755. X** the statistic applies and the lower 16 bits identify the particular
  1756. X** statistic.
  1757. X**
  1758. X** If you desire to add a new statistic identifier, contacts CATS.
  1759. X*/
  1760. X
  1761. X
  1762. X
  1763. X/*
  1764. X** defined ethernet special statistics
  1765. X*/
  1766. X
  1767. X#define S2SS_ETHERNET_BADMULTICAST    ((((S2WireType_Ethernet)&0xffff)<<16)|0x0000)
  1768. X/*
  1769. X** This count will record the number of times a received packet tripped
  1770. X** the hardware's multicast filtering mechanism but was not actually in
  1771. X** the current multicast table.
  1772. X*/
  1773. X
  1774. X#define S2SS_ETHERNET_RETRIES        ((((S2WireType_Ethernet)&0xffff)<<16)|0x0001)
  1775. X/*
  1776. X** This count records the total number of retries which have resulted
  1777. X** from transmissions on this board.
  1778. X*/
  1779. X
  1780. X
  1781. X#endif    /* SANA2_SANA2SPECIALSTATS_H */
  1782. END_OF_FILE
  1783. if test 1206 -ne `wc -c <'include/devices/sana2specialstats.h'`; then
  1784.     echo shar: \"'include/devices/sana2specialstats.h'\" unpacked with wrong size!
  1785. fi
  1786. # end of 'include/devices/sana2specialstats.h'
  1787. fi
  1788. if test -f 'include/devices/sana2specialstats.i' -a "${1}" != "-c" ; then 
  1789.   echo shar: Will not clobber existing file \"'include/devices/sana2specialstats.i'\"
  1790. else
  1791. echo shar: Extracting \"'include/devices/sana2specialstats.i'\" \(1146 characters\)
  1792. sed "s/^X//" >'include/devices/sana2specialstats.i' <<'END_OF_FILE'
  1793. X    IFND    SANA2_SANA2SPECIALSTATS_I
  1794. XSANA2_SANA2SPECIALSTATS_I    SET    1
  1795. X**
  1796. X**    $Id: sana2specialstats.i,v 1.2 91/10/17 12:59:56 dlarson Exp $
  1797. X**
  1798. X**    Defined ids for SANA-II special statistics.
  1799. X**
  1800. X**
  1801. X**    (C) Copyright 1991 Commodore-Amiga Inc.
  1802. X**        All Rights Reserved
  1803. X**
  1804. X
  1805. X
  1806. X    IFND    SANA2_SANA2DEVICE_I
  1807. X    INCLUDE    "sana2/sana2device.i"
  1808. X    ENDC    !SANA2_SANA2DEVICE_I
  1809. X
  1810. X;
  1811. X; The SANA-II special statistic identifier is an unsigned 32 number.
  1812. X; The upper 16 bits identify the type of network wire type to which
  1813. X; the statistic applies and the lower 16 bits identify the particular
  1814. X; statistic.
  1815. X;
  1816. X
  1817. X; If you'd like to add new statistic identifiers, contact CATS.
  1818. X
  1819. X;
  1820. X; defined ethernet special statistics
  1821. X;
  1822. X
  1823. XS2SS_ETHERNET_BADMULTICAST    EQU    ((((S2WIRETYPE_ETHERNET)&$ffff)<<16)|$0000)
  1824. X;
  1825. X; This count will record the number of times a received packet tripped
  1826. X; the hardware's multicast filtering mechanism but was not actually in
  1827. X; the current multicast table.
  1828. X;
  1829. X
  1830. XS2SS_ETHERNET_RETRIES        EQU    ((((S2WIRETYPE_ETHERNET)&$ffff)<<16)|$0001)
  1831. X;
  1832. X; This count records the total number of retries which have resulted
  1833. X; from transmissions on this board.
  1834. X;
  1835. X
  1836. X
  1837. X    ENDC    SANA2_SANA2SPECIALSTATS_I
  1838. END_OF_FILE
  1839. if test 1146 -ne `wc -c <'include/devices/sana2specialstats.i'`; then
  1840.     echo shar: \"'include/devices/sana2specialstats.i'\" unpacked with wrong size!
  1841. fi
  1842. # end of 'include/devices/sana2specialstats.i'
  1843. fi
  1844. if test -f 'readme' -a "${1}" != "-c" ; then 
  1845.   echo shar: Will not clobber existing file \"'readme'\"
  1846. else
  1847. echo shar: Extracting \"'readme'\" \(1031 characters\)
  1848. sed "s/^X//" >'readme' <<'END_OF_FILE'
  1849. XThis distribution contains the SANA-II Network Device Driver Specification,
  1850. Xversion of November 7, 1991, for final comment and approval.  This means
  1851. Xthat no additional changes are expected and that only compelling objections
  1852. Xwill keep this version of the spec from becoming final on January 1, 1991.
  1853. X
  1854. XThis distribution also contains supporting materials in the form of some
  1855. Xexample code.  More example code, including a skeleton SANA-II device
  1856. Xdriver, are planned for the near future.
  1857. X
  1858. XFinally, so that you can actually use this now to develop network protocols,
  1859. Xa beta binary of our A2065 ethernet driver is included.
  1860. X
  1861. X
  1862. XFILES
  1863. X
  1864. X    README        - this file.
  1865. X    driver.txt    - text of driver specification.
  1866. X    sana2driver.doc    - autodoc for driver specification.
  1867. X    copybuff.doc    - autodoc for buffer management functions in spec.
  1868. X
  1869. X    devs/a2065.device - *beta* version of Commodore ethernet driver.
  1870. X                (also works with Ameristar ethernet boards)
  1871. X
  1872. X    plus include files for the specification in "include/devices"
  1873. X    plus example programs in "examples"
  1874. END_OF_FILE
  1875. if test 1031 -ne `wc -c <'readme'`; then
  1876.     echo shar: \"'readme'\" unpacked with wrong size!
  1877. fi
  1878. # end of 'readme'
  1879. fi
  1880. echo shar: End of archive 1 \(of 4\).
  1881. cp /dev/null ark1isdone
  1882. MISSING=""
  1883. for I in 1 2 3 4 ; do
  1884.     if test ! -f ark${I}isdone ; then
  1885.     MISSING="${MISSING} ${I}"
  1886.     fi
  1887. done
  1888. if test "${MISSING}" = "" ; then
  1889.     echo You have unpacked all 4 archives.
  1890.     rm -f ark[1-9]isdone
  1891. else
  1892.     echo You still need to unpack the following archives:
  1893.     echo "        " ${MISSING}
  1894. fi
  1895. ##  End of shell archive.
  1896. exit 0
  1897. -- 
  1898. Mail submissions (sources or binaries) to <amiga@uunet.uu.net>.
  1899. Mail comments to the moderator at <amiga-request@uunet.uu.net>.
  1900. Post requests for sources, and general discussion to comp.sys.amiga.misc.
  1901.